/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package kasus1pendaftaranyudisium;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.BufferedWriter;
import java.io.FileWriter;
import javax.swing.*;

/**
 *
 * @author Dell
 */
public class PanelPeriksaYudisium extends JPanel {

    private JLabel tglmasuk, tglkeluar;
    private JLabel judul, labelnim, labelnama, labelprodi, labelnomorHp, labelperYud, labellengkap;
    private JLabel textnil, textnaskaTA, textbebasLab, textbebasDos, textbuktiLapKP, textsrtKKL;
    private JTextField textmasuk, textkeluar;
    private JTextField textnim, textnama, textprodi, textnmrHp, textperYud;
    private JCheckBox labelnil, labelnaskaTA, labelbebasLab, labelbebasDos, labelbuktiLapKP, labelsrtKKL;
    private JButton tombolbatal;
    private JButton tombolsave;

    public PanelPeriksaYudisium() {
        setLayout(null);

        judul = new JLabel("FORM  DAFTAR YUDISIUM");
        judul.setBounds(220, 0, 200, 50);
        judul.setVisible(true);
        this.add(judul);

        labelnim = new JLabel("Nim");
        labelnim.setBounds(50, 50, 200, 50);
        labelnim.setVisible(true);
        this.add(labelnim);
//-----------------------------------------------------------------------------
        tglmasuk = new JLabel("Tanggal Masuk");
        tglmasuk.setBounds(500, 50, 200, 50);
        tglmasuk.setVisible(true);
        this.add(tglmasuk);

        tglkeluar = new JLabel("Tanggal Keluar");
        tglkeluar.setBounds(500, 120, 200, 50);
        tglkeluar.setVisible(true);
        this.add(tglkeluar);
        
        textmasuk = new JTextField(20);
        textmasuk.setBounds(500, 90, 200, 30);
        textmasuk.setVisible(true);
        this.add(textmasuk);
        
        textkeluar = new JTextField(20);
        textkeluar.setBounds(500, 160, 200, 30);
        textkeluar.setVisible(true);
        this.add(textkeluar);

        textnim = new javax.swing.JFormattedTextField();
        textnim.setPreferredSize(new java.awt.Dimension(60, 20));
        textnim.setBounds(170, 60, 280, 30);
        textnim.setVisible(true);
        this.add(textnim);

        labelnama = new JLabel("Nama");
        labelnama.setBounds(50, 90, 200, 50);
        labelnama.setVisible(true);
        this.add(labelnama);

        textnama = new javax.swing.JFormattedTextField();
        textnama.setPreferredSize(new java.awt.Dimension(60, 20));
        textnama.setBounds(170, 100, 280, 30);
        textnama.setVisible(true);
        this.add(textnama);

        labelprodi = new JLabel("Prodi");
        labelprodi.setBounds(50, 130, 200, 50);
        labelprodi.setVisible(true);
        this.add(labelprodi);

        textprodi = new javax.swing.JFormattedTextField();
        textprodi.setPreferredSize(new java.awt.Dimension(60, 20));
        textprodi.setBounds(170, 140, 280, 30);
        textprodi.setVisible(true);
        this.add(textprodi);

        labelnomorHp = new JLabel("No HP");
        labelnomorHp.setBounds(50, 170, 200, 50);
        labelnomorHp.setVisible(true);
        this.add(labelnomorHp);

        textnmrHp = new javax.swing.JFormattedTextField();
        textnmrHp.setPreferredSize(new java.awt.Dimension(60, 20));
        textnmrHp.setBounds(170, 180, 280, 30);
        textnmrHp.setVisible(true);
        this.add(textnmrHp);

        labelperYud = new JLabel("Periode Yudisium");
        labelperYud.setBounds(50, 210, 200, 50);
        labelperYud.setVisible(true);
        this.add(labelperYud);

        textperYud = new javax.swing.JFormattedTextField();
        textperYud.setPreferredSize(new java.awt.Dimension(60, 20));
        textperYud.setBounds(170, 220, 280, 30);
        textperYud.setVisible(true);
        this.add(textperYud);

        labellengkap = new JLabel("Kelengkapan");
        labellengkap.setBounds(50, 250, 200, 50);
        labellengkap.setVisible(true);
        this.add(labellengkap);

        labelnil = new JCheckBox();
        labelnil.setBounds(170, 265, 20, 20);
        labelnil.setVisible(true);
        this.add(labelnil);

        textnil = new JLabel("Daftar Nilai");
        textnil.setBounds(210, 250, 200, 50);
        textnil.setVisible(true);
        this.add(textnil);

        labelnaskaTA = new JCheckBox();
        labelnaskaTA.setBounds(170, 305, 20, 20);
        labelnaskaTA.setVisible(true);
        this.add(labelnaskaTA);

        textnaskaTA = new JLabel("Naskah TA");
        textnaskaTA.setBounds(210, 290, 200, 50);
        textnaskaTA.setVisible(true);
        this.add(textnaskaTA);

        labelbebasLab = new JCheckBox();
        labelbebasLab.setBounds(170, 345, 20, 20);
        labelbebasLab.setVisible(true);
        this.add(labelbebasLab);

        textbebasLab = new JLabel("bebas pinjam(lab)");
        textbebasLab.setBounds(210, 330, 200, 50);
        textbebasLab.setVisible(true);
        this.add(textbebasLab);

        labelbebasDos = new JCheckBox();
        labelbebasDos.setBounds(330, 265, 20, 20);
        labelbebasDos.setVisible(true);
        this.add(labelbebasDos);

        textbebasDos = new JLabel("bebas pinjam dari dosen");
        textbebasDos.setBounds(370, 250, 200, 50);
        textbebasDos.setVisible(true);
        this.add(textbebasDos);

        labelbuktiLapKP = new JCheckBox();
        labelbuktiLapKP.setBounds(330, 305, 20, 20);
        labelbuktiLapKP.setVisible(true);
        this.add(labelbuktiLapKP);

        textbuktiLapKP = new JLabel("penyerahan laporan KP");
        textbuktiLapKP.setBounds(370, 290, 200, 50);
        textbuktiLapKP.setVisible(true);
        this.add(textbuktiLapKP);

        labelsrtKKL = new JCheckBox();
        labelsrtKKL.setBounds(330, 345, 20, 20);
        labelsrtKKL.setVisible(true);
        this.add(labelsrtKKL);

        textsrtKKL = new JLabel("surat keterangan KKL/KI");
        textsrtKKL.setBounds(370, 330, 200, 50);
        textsrtKKL.setVisible(true);
        this.add(textsrtKKL);

        tombolsave = new javax.swing.JButton("simpan");
        tombolsave.setPreferredSize(new java.awt.Dimension(120, 60));
        this.add(tombolsave);
        tombolsave.setBounds(120, 400, 200, 30);
        tombolsave.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent h) {
                save(h);
            }

            private void save(ActionEvent h) {
                JFileChooser saveChooser = new JFileChooser(); // again, open a file chooser
                int option = saveChooser.showSaveDialog(saveChooser);
                if (option == JFileChooser.APPROVE_OPTION) {
                    try {
                        // create a buffered writer to write to a file
                        BufferedWriter out = new BufferedWriter(new FileWriter(saveChooser.getSelectedFile().getPath()));
                        //out.write(this.save(h).getText()); // write the contents of the TextArea to the file
                        out.close(); // close the file stream
                    } catch (Exception ex) { // again, catch any exceptions and...
                        // ...write to the debug console
                        System.out.println(ex.getMessage());
                    }
                }
            }

            public void System(int i) {
            }
        });


        tombolbatal = new javax.swing.JButton("batal");
        tombolbatal.setPreferredSize(new java.awt.Dimension(120, 60));
        this.add(tombolbatal);
        tombolbatal.setBounds(350, 400, 200, 30);
        tombolbatal.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent h) {
                exitcommand(h);
            }

            private void exitcommand(ActionEvent h) {

                System.exit(WIDTH);
            }

            private void System(int i) {
            }
        });
    }

    public static void main(String[] args) {
        // TODO code application logic here
        JFrame testFrame = new JFrame();
        PanelPeriksaYudisium testPanel = new PanelPeriksaYudisium();
        testFrame.getContentPane().add(testPanel);
        testFrame.setSize(800, 500);
        testFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        testFrame.setVisible(true);
    }
}